﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using AppStore.Domain.Abstract;
using AppStore.Domain.DAO;
using AppStore.Domain.Entities;

namespace AppStore.Domain.Concrete
{
    public class CommentsRepository : ICommentsRepository
    {
        private AppStoreDBConnection context = new AppStoreDBConnection();

        public IQueryable<Comment> Comments { get { return context.Comments; } }
        public void addComment(Comment comment)
        {
            context.Comments.Add(comment);
            context.SaveChanges();
        }

        public void removeComment(int commentId)
        {
            context.Comments.Remove(context.Comments.Single(c => c.commentId == commentId));
        }
    }
}
